package com.sky.controller.user;

import com.sky.constant.StatusConstant;
import com.sky.result.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.*;

@RestController("userShopController")
@Slf4j
@RequestMapping("/user/shop")
public class ShopController {
    @Autowired
    RedisTemplate redisTemplate;

    //获取营业状态
    @GetMapping("status")
    public Result getShopStatus() {
        //获取店铺状态 (从redis中获取店铺状态)
        Integer shopStatus = (Integer) redisTemplate.opsForValue().get(StatusConstant.SHOP_STATUS);
        //封装处理结果
        return Result.success(shopStatus);
    }
}
